import java.io.File;
import java.io.IOException;

//文件的移动和重命名
public class Demo_4 {
    public static void main(String[] args) throws IOException, InterruptedException {
        File file = new File("./AAA.txt");
        File file1 = new File("./AAA1.txt");
        file.createNewFile();
        Thread.sleep(2000);
        //改名
        file.renameTo(file1);

        File file2 = new File("./AAA2.txt");
        file2.createNewFile();
        File file3 = new File("./aaa/AAA2.txt");
        //移动
        file2.renameTo(file3);


    }
}
